package io.zhengsh.juc._1lock.atomic;

import java.util.concurrent.CountDownLatch;

public class AtomicTest {

    public static int total = 0;

    public static void main(String[] args) throws InterruptedException {
        CountDownLatch downLatch = new CountDownLatch(1000);
        for (int i = 0; i < 1000; i++) {
            new Thread(() -> {
                for (int j = 0; j < 1000; j++) {
                    total++;
                }
                downLatch.countDown();
            }).start();
        }
        downLatch.await();
        System.out.println(total);
    }
}
